version: '3.8'

services:
  db:
    image: postgres:12.4
    volumes:
      - postgres_data:/var/lib/postgresql/data/
    env_file:
      - ./.env
  web:
    build: .
    restart: always
    ports:
      - "8000:8000"
    volumes:
      - static_value:/code/static/
      - media_value:/code/media/
    depends_on:
      - db
    env_file:
      - ./.env

  nginx:
    image: nginx:1.19.3

    ports:
      - "80:80"

    volumes:
      - ./nginx/default.conf:/etc/nginx/conf.d/default.conf

      - static_value:/var/html/static/

      - media_value:/var/html/media/

    depends_on:
      - web

volumes:
  postgres_data:
  static_value:
  media_value:
 